/******************************************************
* Team WB
* Brett Cate, William Kim
* 
* Register16 ADT Header
*******************************************************/

#ifndef SC2_H
#include "sc2.h"
#endif

#ifndef REGISTER16_H
#define REGISTER16_H

typedef ushort Register;
typedef Register* RegisterPtr;

/*
Creates a new Register object and returns a pointer to it.

return value: A pointer to the newly created Register.
*/
RegisterPtr register_new();


/*
Returns the unsigned char contained in the low order byte of the given register.

parameter (the_registerPtr): pointer to the register whose low order byte is returned.
parameter (*the_error): Pointer to the int value for the error code of this function.

return value: A uchar containing the low order byte of the given register.
*/
uchar register_getLowByte(RegisterPtr the_registerPtr, int* the_error);


/*
Returns the high order byte of the given register.

parameter (the_registerPtr): pointer to the register whose high order byte is returned.
parameter (*the_error): Pointer to the int value for the error code of this function.

return value: A uchar containing the high order byte of the given register.
*/
uchar register_getHIByte(RegisterPtr the_registerPtr, int* the_error);



/*
Puts the given byte in the low order byte of the given register, and returns the error code.

parameter (the_registerPtr): Pointer to the register whose low order byte is changed.
parameter (the_byte): The byte to be placed in the given register.

return value: The error code for this function as an int.
*/
int register_putLowByte(RegisterPtr the_registerPtr, uchar the_byte);



/*
Puts the given byte in the high order byte of the given register, and returns the error code.

parameter (the_registePtr): Pointer to the register whose high order byte is changed.
parameter (the_byte): The byte to be placed in the given register.

return value: The error code for this function as an int.
*/
int register_putHIByte(RegisterPtr the_registerPtr, uchar the_byte);



/*
Returns the sign bit of the given register, either a 1 or 0.

parameter (the_registerPtr): Pointer to the register whose sign bit is returned.
parameter (*the_error): Pointer to int value of the error code for this function.

return value: A uchar containing the sign bit of the given register.
*/
uchar register_signOf(RegisterPtr the_registerPtr, int* the_error);


/*
Returns the ushort value contained in the given register.

parameter (the_registerPtr): Pointer to the register whose value is returned.
parameter (*the_error): Pointer to the int value of the error code for this function.

return value: A ushort containing the value of the given register.
*/
ushort register_getRegValue(RegisterPtr the_registerPtr, int* the_error);



/*
Puts the given ushort value in the given register, and returns the error code.

parameter (the_registerPtr): Pointer to the register where the value is put.
parameter (the_word): The value to be put into the given register.

return value: The int value of the error code for this function.
*/
int register_putRegValue(RegisterPtr the_registerPtr, ushort the_word);

#endif

/* End Program */
